﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
using Simple.Services.System;
using OfficeOpenXml;
using System.IO;
using Simple.Services.System.QHSEViolationCategory.Models;
using Simple.Services.System.QHSEDanger.Models.AnalysisInput;
using System.Globalization;
using System.Security.Cryptography;
using Microsoft.EntityFrameworkCore;
public class QHSESqlService
{
    private readonly SimpleDbContext _context;
    public QHSESqlService(SimpleDbContext context)
    {
        _context = context;
    }
    public async Task<int> ExecuteInsertAsync(string sqlQuery)
    {
        // 执行 INSERT SQL 查询
        return await _context.Database.ExecuteSqlRawAsync(sqlQuery);
    }
    public async Task<int> ExecuteUpdateAsync(string sqlQuery)
    {
        // 执行 UPDATE SQL 查询
        return await _context.Database.ExecuteSqlRawAsync(sqlQuery);
    }
    public async Task<List<TEntity>> ExecuteSelectAsync<TEntity>(string sqlQuery) where TEntity : class
    {
        // 执行 SELECT SQL 查询
        return await _context.Set<TEntity>().FromSqlRaw(sqlQuery).ToListAsync();
    }
}
